package advancedio;

import java.io.*;

public class CopyFile {
	
	public static void copyByReadline(String src,String dest){
		try {
			FileReader input = new FileReader(src);
			BufferedReader bufInput = new BufferedReader(input);
			
			FileWriter output = new FileWriter(dest);
			BufferedWriter bufOutput = new BufferedWriter(output);
			
			String line;
			line = bufInput.readLine();
			while(line != null){
				bufOutput.write(line,0,line.length());
				bufOutput.newLine();
				line = bufInput.readLine();
			}
			
			bufInput.close();
			bufOutput.close();
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	public static void main(String[] args) {
		CopyFile.copyByReadline("E:\\NavTeqOB.bmp", "E:\\duke.bmp");

	}

}
